import GetModelValue
import os

path = r'C:\Users\Administrator\Desktop\lop\HD'
exporpath = r'F:\War3\war3_WE\model\[HD]'

for root, dirs, files in os.walk(path):
    for file in files:
        if '.mdx' == file[-4:].lower():
            _path = 'blp\\'+'[%s]'%('HD')
            model = GetModelValue.GetModelValue(root+'\\'+file)
            textures = model.TEXS.GetTexturePath()
            for texture in textures :
                model.TEXS.ReviseTexturePath(textures.index(texture),_path+'\\'+texture)
            model.ExportModel(exporpath+'\\'+file)

